package com.lxj.passkeep.service.impl;


import com.lxj.passkeep.common.enums.BasicEnum;
import com.lxj.passkeep.common.exception.BaseException;
import com.lxj.passkeep.common.utils.StringUtils;
import com.lxj.passkeep.dto.UserDto;
import com.lxj.passkeep.enity.User;
import com.lxj.passkeep.mapper.LoginMapper;
import com.lxj.passkeep.service.LoginService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class LoginServiceImpl implements LoginService {
    @Resource
    private LoginMapper loginMapper;
    @Override
    public void login(UserDto userDto) {
        if (StringUtils.isEmpty(userDto.getUserName()) || StringUtils.isEmpty(userDto.getPassword())) {
            throw new BaseException(BasicEnum.PARAM_ERROR);
        }
        User user = loginMapper.selectUser(userDto);
        if (user == null){
            throw new BaseException(BasicEnum.LOGIN_FAIL);
        }
    }
}
